home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Netware Super Library
/
Netware Super Library.iso
/
timevent
/
taskmstr
/
vrepair.tsk
< prev
Wrap
Text File
|
1995-05-07
|
6KB
|
258 lines
// Enable LOG ON for debugging purposes since it will
// show the lines processed and their structure.
// (Remove the leading slashes to enable LOG ON)
// LOG ON
// Change to the System Console screen before processing.
CHANGE_SCREEN "System Console"
// Clear the System Console screen.
CLS
// The following displays the currently mounted
// volumes on the console screen.
VOLUMES
// Capture the current System Console screen image as
// text (default mode).
SAVE_SCREEN SYS:SYSTEM\CONSOLE.DAT
// Open the System Console screen text image for input.
OPEN_READ SYS:SYSTEM\CONSOLE.DAT
// This WHILE/LOOP scans for the string "Mounted Volumes"
// in each line of the captured System Console screen.
// Mounted Volumes is displayed on the line preceding
// the Volume names shown by the VOLUMES console command.
// (Note: The first pass fails since %1 is not defined.)
WHILE NOT SCAN_STRING "Mounted Volumes" "%1"
// The "Mounted Volumes" string was not found so read the next
// line from the input file (System Console screen text image).
READ %1
// Abort the Task if a read error occurs.
IF ERRORLEVEL
ECHO Read error occurred!
ABORT
ENDIF
// If the read returns a null string, exit since the
// System Console screen should be padded with spaces.
// (Note: No spaces are allowed between the strings and
// the operators in comparisons.)
IF "%1"==""
ECHO Unable to locate volume information!
ABORT
ENDIF
// Repeat the process until "Mounted Volumes"
// or a null string is found.
LOOP
// Load the VREPAIR NLM.
LOAD VREPAIR
// Abort this Task if VREPAIR cannot be loaded.
IF ERRORLEVEL
ECHO Unable to load VREPAIR!
ABORT
ENDIF
// The following WHILE/LOOP tests if the read string is null
// The first pass it will not be since it matched above.
// (Note: No spaces are allowed between the strings and the
// operators in comparisons.)
WHILE "%1">""
// Read the next line from the captured System Console screen
READ %1
// Abort the Task if a read error occurs.
IF ERRORLEVEL
ECHO Read error occurred!
ABORT
ENDIF
// If the string "DOS" is not found on the line, probably
// is not a volume since DOS Name Space support is typical.
IF NOT SCAN_STRING "DOS" "%1" THEN BREAK
// In this example, we do not want to process the SYS: volume.
// (Note: If repair of the SYS: volume is desired, VRepair
// will have to be loaded from the DOS partition,
// LOAD C:\NETWARE\VREPAIR. The captured screen
// image will also have to be saved to the DOS
// partition, DEFINE %0 C:\CONSOLE.DAT.)
IF SCAN_STRING "SYS" "%1"
ECHO Not processing SYS: in this test!
CONTINUE
ENDIF
// Dismount the volume in order to perform VRepair.
DISMOUNT %1
// Make sure the VRepair Status Screen is active.
CHANGE_SCREEN "VRepair Status Screen"
// Repair the first (only) dismounted volume.
KEYIN "1" ENTER
// Pause a second to let it get started
WAIT 1
// Use F1 key to change the default options
KEYIN F1
// Change to the VRepair Error Screen and set the
// options not to prompt for keyins.
CHANGE_SCREEN "VRepair Error Screen"
// Set the options to: Do Not Pause After Errors
KEYIN "1" ENTER
// Continue the VRepair process.
KEYIN "0" ENTER
// Pause a second to let it reset the options
WAIT 1
// Switch the default screen back to the VRepair
// Status Screen so we can check for completion.
CHANGE_SCREEN "VRepair Status Screen"
// This Task uses the %9 user defined variable to
// track how long VRepair works.
// Set %9 to the proper numeric value and compare length.
DEFINE %9 000
// Scan the screen for the prompt <Press any key ...>
// which indicates completion of the VRepair.
WHILE NOT SCAN_SCREEN "<Press any key to continue>"
// Pause 1 second before continuing with the loop
WAIT 1
// Increment the counter after each 1 second pause.
DEFINE %9 %9+=1
// If more than 5 minutes passes (300 seconds),
// better abort since it should not take that long
// to repair the volume.
// (Note: This may need to be adjusted depending
// upon volume size and file count.)
IF %9>300
ECHO VRepair has run for 5 minutes.
ECHO Maybe there is a problem?!?!
ABORT
ENDIF
// Continue processing the next volume shown.
LOOP
// Clear the <Press any key ...> prompt
KEYIN " "
// Remount the volume just repaired.
MOUNT %1
// Repeat the process until no more Volumes exist.
// (Note: We assume no more volumes exist if we
// do not find the string "DOS" on the line,
// i.e., typical NetWare volumes will have
// DOS Name Space support which appears
// beside the volume name.)
LOOP
// Finished with VRepair
UNLOAD VREPAIR
// Delete the temporary file where we wrote the
// captured System Console screen image.
DEL SYS:SYSTEM\CONSOLE.DAT
// Disable LOG ON (if previously enabled).
// (Note: This is not required since TaskMaster will
// clean up after the Task but it is a sign of
// proper design and follow through in the logic.)
// LOG OFF